import type FormItem from "@/components/form/type/FormItem";
import type TableColumn from "@/components/table/type/TableColumn.ts";

/**
 * 查询条件表单结构数据
 */
export const searchSchema: FormItem[] = [
    {row: 0, span: 4, label: "任务名称", key: "taskName", type: "input", attr: {"clearable": true}},
    {row: 0, span: 4, label: "任务全类名", key: "className", type: "input", attr: {"clearable": true}},

    {row: 0, span: 4, label: "操作", key: "operate", type: "slot"},
]

/**
 * 表格结构数据
 */
export const tableColumns: TableColumn[] = [
    {key: "id", title: "序号", width: 80, align: "center", type: "index"},
    {key: "taskName", title: "任务名称", align: "center", type: "string"},
    {key: "cron", title: "任务执行周期", align: "center", type: "string"},
    {
        key: "type",
        title: "任务类型",
        align: "center",
        type: "tag",
        callback: (row: any) => row['type'] === 1 ? '定时任务' : '其他任务'
    },
    {key: "className", title: "任务全类名", align: "center", type: "string"},
    {key: "parameter", title: "任务参数", align: "center", type: "string"},
    {key: "status", title: "任务状态", align: "center", type: "switch", attr: {"activeValue": 1, "inactiveValue": 0}},

    {key: "operate", title: "操作", width: 150, type: "slot", align: "center"},
]

/**
 * dialog结构数据
 */
export const dialogScheme: FormItem[] = [
    {row: 0, span: 12, label: "任务名称", key: "taskName", placeholder: "任务名称", type: "input"},
    {row: 0, span: 12, label: "任务执行周期", key: "cron", placeholder: "任务执行周期", type: "input"},
    {row: 1, span: 12, label: "任务类型", key: "type", placeholder: "任务类型", type: "input"},
    {row: 1, span: 12, label: "任务状态", key: "status", placeholder: "任务状态", type: "switch", attr: {"activeValue": 1, "inactiveValue": 0}},
    {row: 2, label: "任务全类名", key: "className", placeholder: "任务全类名", type: "input"},
    {row: 3, label: "任务参数", key: "parameter", placeholder: "任务参数", type: "textarea"},
]